//request 是一个axios对象（经过设置信息的）
import request from '@/utils/request'


// 确认支付
export function confirmPay(data) {
    return request({
        url: '/api/pay/trade/page/pay',
        //post请求
        method: 'post',
        data
    })
}


export function login(data) {
    return request({
        url: '/api/userlogin/login',
        //post请求
        method: 'post',
        data
    })
}
export function add(data) {
    return request({
        url: '/api/user/add',
        //post请求
        method: 'post',
        data
    })
}
export function getCode(){
    return request({
        url: '/api/userlogin/get',
        method: 'get'
    })
}
export function logout(params) {
    return request({
        url: '/api/user/logout',
        //get请求
        method: 'get',
        params
    })
}

export function getUsers(data) {
    return request({
        //设置请求数据格式为json
        headers: {"Content-Type": "application/json;charset=UTF-8"},
        url: '/api/user/logout',
        method: 'post',
        data
    })
}

//上传图片
export function uploadImage(data) {
    return request({
        //设置请求数据格式为multipart/form-data
        headers: {"Content-Type": "multipart/form-data;charset=UTF-8"},
        url: '/api/user/image/upload',
        method: 'post',
        data
    })
}
export function all() {
    return request({
        url: '/api/user/all',
        method: 'post'

    })
}
export function page(data) {
    return request({
        url: '/api/user/page',
        //post请求
        method: 'post',
        data
    })
}
export function findUser(data) {
    return request({
        // headers: {"Content-Type": "application/json;charset=UTF-8"},
        url: `/api/user/findUser/${data.id}`,
        //post请求
        method: 'post',
        data
    })
}
export function updateImg(data) {
    return request({
        // headers: {"Content-Type": "application/json;charset=UTF-8"},
        url: '/api/user/updateImg',
        //post请求
        method: 'post',
        data
    })
}
export function updateMessage(data) {
    return request({
        // headers: {"Content-Type": "application/json;charset=UTF-8"},
        url: '/api/user/update',
        //post请求
        method: 'post',
        data
    })
}
export function findAddress(data) {
    return request({
        url: `/api/useraddress/all/${data.id}`,
        //post请求
        method: 'post',
        data
    })
}

//用户更改密码
export function check(data) {
    return request({
        url: `/api/user/check`,
        //post请求
        method: 'post',
        data
    })
}

export function loginByPhone(data) {
    return request({
        url: `/api/user/loginbyphone`,
        //post请求
        method: 'post',
        data
    })
}



